//
//  GoodsCommentModel.swift
//  OnceNectar
//
//  Created by vic.hu on 2018/6/5.
//  Copyright © 2018年 com.inwhoop. All rights reserved.
//

import Foundation
import MappingAce
import SwiftyJSON

struct GoodsCommentModel:Mapping {
    var beRepliedUserId :String?
    var questionId :String?
    var clientName :String?
    var orderId :String?
    var predictabilityGrade :String?
    var unapprovedReason :String?
    var created :String?
    var commentContent :String?
    
    var goodId :String?
    var ifLiked :String?
    var commentStatus :String?
    var likesCount :String?
    var commentator :String?
    var beautyGrade :String?
    var commentatorID :String?
    var goodName :String?
    var specAndCol :String?
    var orderTime :String?
    
    var id :String?
    var beRepliedUser :String?
    var jointId :String?
    var costGrade :String?
    
    var pics :[PicModel]?
    
    var commentUser :AuthorModel?

    var relatedCommentsCount: String?

}


extension GoodsCommentModel{
    mutating func initPics(arr: [JSON]) {
        
        var xlabers :[PicModel] = []
        for object in arr {
            
            let xmodel = PicModel(fromDic: object.dictionary! )
            
            xlabers.append(xmodel)
        }
        pics = xlabers
    }
    
    mutating func initAuthor(dic: [String:Any]) {
        commentUser = AuthorModel(fromDic: dic)
    }
}
